<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>变色</title>
    <script>
        function changeBackColor(color){
            document.body.style.backgroundColor=color;
        }
    </script>
</head>
<body>
    <button onclick="changeBackColor('red')">红色</button>
    <button onclick="changeBackColor('blue')">蓝色</button>
    <button onclick="changeBackColor('green')">绿色</button>
    <button onclick="changeBackColor('yellow')">黄色</button>
</body>
</html>